package libra;

import java.util.Date;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
public class CollectLogController {
	private static final Logger log = LoggerFactory.getLogger(CollectLogController.class);
	
	@Value("${spring.application.name}")
	String appName;
	
	@Autowired
	RestTemplate restTemplate;

	@RequestMapping("log")
	public Object log() {
		log.info("["+appName+"]记录日志..."+new Date());
		restTemplate.postForObject("http://"+ "SwLogServiceB" +"/log", null, Map.class);
		return Map.of();
	}
}
